Delayed respawn timer

72

Delayed respawn timer -

public class DemoBehaviour : MonoBehaviour {
    public GameObject otherGameObject;
 
    public void Foo() {
        StartCoroutine(TemporarilyDeactivate(20));
    }
 
    private IEnumerator TemporarilyDeactivate(float duration) {
        otherGameObject.SetActive(false);
        yield return new WaitForSeconds(duration);
        otherGameObject.SetActive(true);
    }
}

Comments

Submit
0 Comments